<?php
/**
 * Zead
 *
 * LICENSE	
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.opensource.org/licenses/bsd-license.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to eu@marcelomx.com so we can send you a copy immediately.
 *
 * @category   Zead
 * @author     Marcelo Rodrigues Gonzaga <eu@marcelomx.com>
 * @copyright  Copyright (c) 2008 Marcelo Rodrigues Gonzaga
 * @link       http://code.google.com/p/zead 
 * @license    http://www.opensource.org/licenses/bsd-license.php     New BSD License
 *
 **/
 

/**
 * Class Zead_Quiz_Question_Abstract 
 * 
 * @category   Zead
 * @package    Zead_Quiz
 * @subpackage Zead_Quiz_Question
 * @copyright  Copyright (c) 2008 Marcelo Rodrigues Gonzaga 
 * @license    http://www.opensource.org/licenses/bsd-license.php     New BSD License  
 */
abstract class Zead_Quiz_Question_Abstract
{
	/** @var string **/
	protected $_title;
	
	/** @var string **/
	protected $_description;
	
	/** @var string **/
	protected $_required = false;
	
	/** @var array **/
	protected $_responses = array();

	/**
	 * Class constructor
	 *
	 * @param string $title
	 * @param string $description
	 * @param array  $responses
	 */
	public function __construct($title, $description = null, $required = false, array $responses = array())
	{
		$this->_title = $title;
		$this->_description = $description;
		$this->_responses = $responses;
	}
	
	/**
	 * Sets the question title
	 * @param string $title
	 */
	public function setTitle($title)
	{
		$this->_title = $title;
		return $this;
	}
	
	/**
	 * Returns question title
	 * @return string $title
	 */
	public function getTitle()
	{
		return $this->_title;
	}
	
	/**
	 * Sets the question description
	 * @param string $description
	 */
	public function setDescription($description)
	{
		$this->_description = $description;
		return $this;
	}
	
	/**
	 * Returns the description
	 * @return string
	 */
	public function getDescription()
	{
		return $this->_description;
	}
	
	/**
	 * Returns responses
	 * @return array
	 */
	public function getResponses()
	{
		return $this->_responses;
	}
	
	/**
	 * Sets the responses list
	 * @param array $responses
	 */
	public function setResponses($responses)
	{
		$this->_responses = $responses;
		return $this;
	}
	
	/**
	 * Adds a response to question
	 *
	 * @param Zead_Quiz_QuestionResponse_Abstract|string
	 * @param string $label
	 * @param string $desc
	 */
	public function addResponse($label, $value)
	{
		$this->_responses[] = array('label' => $label, 'value' => $value);
	}
}
